Skip to content

Raise error in tools.costs when a technology is assigned a reduction rate for which it does not have value #270

Draft
measrainsey wants to merge 3 commits intomainfrom
mm/costs/add-error
Draft

Raise error in tools.costs when a technology is assigned a reduction rate for which it does not have value #270
measrainsey wants to merge 3 commits intomainfrom
mm/costs/add-error

Conversation

@measrainsey
Copy link
Copy Markdown
Member

@measrainsey measrainsey commented Dec 18, 2024

Small PR to add an error in the costs tool in instances where a technology has a reduction category that is missing data

This issue came up in #235 (see @khaeru's comment here), where a technology was missing a reduction rate category in cost_reduction.csv that other technologies had. In this case, it didn't matter too much as that missing cost reduction category was never specified for that technology in the scenarios_reduction.csv. However, a hypothetical was brought up: what happens if a technology is assigned a reduction category for a scenario, but said reduction category does not exist for said technology?

I have added a few lines to check for these instances and if they exist, the tool should raise an error.

How to review

For @khaeru and/or @glatterf42 : Read the diff and note that the CI checks all pass.

PR checklist

  • Continuous integration checks all ✅
  • Add or expand tests; coverage checks both ✅
  • Add, expand, or update documentation.
  • Update doc/whatsnew.

@measrainsey measrainsey added the costs `.tools.costs`/cost data preparation label Dec 18, 2024
@measrainsey measrainsey self-assigned this Dec 18, 2024
@measrainsey measrainsey changed the title Raise error when a technology is assigned a reduction rate it does not have value a for in tools.costs Raise error in tools.costs when a technology is assigned a reduction rate for which it does not have value Dec 18, 2024
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 18, 2024

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.4%. Comparing base (a45fce4) to head (ecf2597).
⚠️ Report is 1846 commits behind head on main.

Files with missing lines Patch % Lines
message_ix_models/tools/costs/decay.py 50.0% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main    #270     +/-   ##
=======================================
- Coverage   78.3%   77.4%   -0.9%     
=======================================
  Files        217     217             
  Lines      16851   16854      +3     
=======================================
- Hits       13196   13049    -147     
- Misses      3655    3805    +150     
Files with missing lines Coverage Δ
message_ix_models/tools/costs/decay.py 97.1% <50.0%> (-2.9%) ⬇️

... and 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@khaeru khaeru force-pushed the mm/costs/add-error branch from fdd2dfd to ecf2597 Compare March 10, 2025 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

costs `.tools.costs`/cost data preparation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant